package com.ggshily.game.model.ms3d
{
	import flash.utils.ByteArray;
	
	public class Ms3d_group
	{
		public var flags : int;                               // (byte)
		public var name : String;                             // (char[32])
		public var numtriangles : int;                        // (word)
		public var triangleIndices : Array;
		public var materialIndex : int;                       // (char)
		
		public function Ms3d_group(bytes : ByteArray = null)
		{
			if(bytes)
			{
				flags = bytes.readUnsignedByte();
				name = bytes.readUTFBytes(32);
				numtriangles = bytes.readShort();
				triangleIndices = new Array(numtriangles);
				for(var i : int = 0; i < numtriangles; i++)
				{
					triangleIndices[i] = bytes.readShort();
				}
				materialIndex = bytes.readUnsignedByte();
			}
		}
	}
}